//
//  OpenEyesViewController.m
//  Open Eyes
//
//  Created by dllo on 16/6/23.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "OpenEyesViewController.h"
#import "EveryDayViewController.h"
#import "FindViewController.h"
#import "HotViewController.h"

@interface OpenEyesViewController ()

@end

@implementation OpenEyesViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    EveryDayViewController *every = [[EveryDayViewController alloc]init];
    FindViewController *find = [[FindViewController alloc]init];
    HotViewController *hot = [[HotViewController alloc]init];
    [self addChildVC:every Title:@"每日精选" Image:@"EVERY.png" SeleImage:@""];
    [self addChildVC:find Title:@"发现更多" Image:@"FIND.png" SeleImage:@""];
    [self addChildVC:hot Title:@"热门排行" Image:@"HOT.png" SeleImage:@""];
    
    
    
}




-(void)addChildVC:(UIViewController *)childVC
            Title:(NSString *)title
            Image:(NSString *)image
        SeleImage:(NSString *)seleImage{
    
    UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:childVC];
    
    childVC.title = title;
    

    childVC.tabBarItem.image = [UIImage imageNamed:image];
    
    childVC.tabBarItem.selectedImage = [[UIImage imageNamed:seleImage] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
    NSMutableDictionary *dicOne = [NSMutableDictionary dictionary];
    dicOne[NSForegroundColorAttributeName] = [UIColor grayColor];
    NSMutableDictionary *dicTwo = [NSMutableDictionary dictionary];
    dicTwo[NSForegroundColorAttributeName] = [UIColor blackColor];
    [childVC.tabBarItem setTitleTextAttributes:dicOne forState:UIControlStateNormal];
    [childVC.tabBarItem setTitleTextAttributes:dicTwo forState:UIControlStateSelected];
    
    [self addChildViewController:nav];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
